//
//  UIImage+useColorCreateImage.swift
//  MyLottery
//
//  Created by wujunjie on 2018/7/18.
//  Copyright © 2018年 wujunjie. All rights reserved.
//

import UIKit
extension UIImage{
    class func useColorCreateImage(color:UIColor,size:CGSize)->UIImage {
        ///开启图片上下文
        UIGraphicsBeginImageContext(size)
        ///设置颜色
        color.setFill()
        //填充
        UIRectFill(CGRect(origin:CGPoint(x:0,y:0), size: size))
        //获取图片
        let image =   UIGraphicsGetImageFromCurrentImageContext()
        //关闭图片上下文
        UIGraphicsEndImageContext()
        return image!
    }
}
